package com.qing.consumer.controller;

import com.qing.api.pojo.User;
import com.qing.api.service.UserClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class UserController {


    @Autowired
    private UserClientService userClientService;

    @PostMapping("/consumer/user")
    public void addUse(@RequestBody User user){
        userClientService.addUse(user);
    }

    @GetMapping("/consumer/user/{id}")
    public User queryById(@PathVariable("id") Long id){
        return  userClientService.queryById(id);
    }

    @GetMapping("/consumer/user/list")
    public List<User> queryUser(@RequestParam(value = "name",defaultValue = "",required = false) String name){
        return  userClientService.queryUser(name);
    }


}
